<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script type="text/javascript">
        var arr3 = [5, 2, 11, 3, 4, 1];
        var result = arr3.sort(function(a, b) {
            return a - b; //升
            //return b-a;//降
        });
        console.log("arr3=", JSON.stringify(arr3));
        console.log("result=" + JSON.stringify(result));
    </script>
</body>

</html>